<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:p="http://primefaces.org/ui">
    
    
 	<ui:composition template="/pages/template.xhtml">
	    <ui:define name="conteudo">
		   <f:view beforePhase="#{authorizationListener.anuncianteAndAdminPhase}" >
			
			<h:form id="form_tab_categorias">  
			    <p:treeTable id="treetable" value="#{categoriaBean.treeCategorias}" var="categoria" >  
			        <f:facet name="header">  
			            Tabela de categorias 
			        </f:facet>  
			  
			        <p:column style="width:32%">  
			            <f:facet name="header">  
			                Nome  
			            </f:facet>  
			            <h:outputText value="#{categoria.nome}" />  
			        </p:column>  
			 	 <c:if test="#{userSession.tipoUsuario == 'A' }">
			        <p:column style="width:28">  
			            <h:commandLink value="Editar" action="#{categoriaBean.editarCategoria}" immediate="true">
							<f:setPropertyActionListener target="#{categoriaBean.categoria}" value="#{categoria}" />
						</h:commandLink> 
			        </p:column>  
		        </c:if>
			    </p:treeTable>  
			</h:form>
		  </f:view>
	    </ui:define>
  	</ui:composition>
  	
</html>